AN006 - Example of using and calibrating the HEAD2 device

In this section we want to describe the first steps that will make the first approach to the HEAD2 device.
We can divide in the following sections, the proceed of the operation:

Device declaration in the configuration unit

As was already explained in the description of the device, you must program properly the configuration unit of application. It is very important to the piece of code that declares the device, here you should indicate the hardware resources to be used to ensure proper operation. It will be the responsibility of the programmer to pick and choose the most appropriate inputs and outputs. For example with the following line of code:

;--------------------------------- 
; Internal device declaration 
;--------------------------------- 
INTDEVICE 
Heads HEAD2 0002 2.CNT01 3.INP01 X.X X.X 3.OUT01 3.OUT02 3.OUT03 3.OUT04 X.X X.X X.X X.X

You define an HEAD2 device with “Heads” name with sampling time to 2 ms. Have been declared the following hardware resources: the input to the bidirectional counter has 2.CNT01 address (where 2 indicates the slot seat clamp identification while CNT01 is the mnemonic name of the input), the digital input on the piece presence sensor 3.INP01 (the remaining two entries have been omitted which may be used by sensors for power factor correction of the position of the workpiece) and four digital outputs that will command the machine sanding heads.

An application that has just inside the device declaration in the configuration unit and a qcl unit that it does not run anything (except WAIT forced) already allows to perform the first operations using the device capabilities. In fact, after you download the application on the instrument and having done work, it can change the parameters, observe the states or give commands to devices using the appropriate monitor from QView.
This is very convenient in the early stages of planning When you just want to make some runs or being debugged.
Ensure that the device operates properly however, some parameters that are configured correctly carrying out a proper calibration to adapt the capabilities of the instrument to the physical issues of the machine.

Correct device parameterization

At this point it is worth recalling how could a machine controlled by the HEAD device: a conveyor belt allows you to move material below some machining heads, This is connected to an encoder that allows the tool to know his speed. It should be noted that this speed is only measured and that there is no control of axis movement.
At the beginning of the tape is usually placed a sensor (optical or mechanical) that determines the presence and length of a piece of material to be processed, it is possible also to use more two sensors at different distances in order to verify the presence of the piece.
The heads are controlled using the digital outputs.

As you can deduce from the declaration line device they identify three basic elements that are controlled by device:

Calibration for the measurement of the speed tape

Measure and pulse introduction

Let us consider the case (widespread) where the bi-directional transducer is a digital encoder directly keyed on the roller axis that moves the tape. You will need to set the correctly measure and pulse parameters of the device so that it can interpret the pulses arriving at QMove, the instrument then you can calculate the speed of the axis.
The measure and pulse introduction establishes a correspondence between a space in a unit of your choice and a certain number of pulses. In the event that the user already knows the space covered in a round encoder then you'll proceed directly to projecting values.
Let's clarify this concept with an example: If the encoder emits 1000 pulses/Rev and you know that the axis moves about 5 cm When the encoder performs exactly one lap then you can insert the following values:

AxisX:measure = 50;
AxisX:pulse = 4000

The measure value introduced It also involves choosing a unit of measure of mm for measuring the positions, in the pulse parameter Yes it's introduced a value equal to the number of pulses is multiplied for 4. Remember that the measure/pulse relationship must be a value between 0.00935 to 1. It is important to emphasize that the values described above are taken as reference: It is not necessary to introduce the parameters with reference to an encoder revolution as we will describe below.

When the user does not know in advance the measurement parameters, will still be able to make the correct calibration by following these steps:

The encoder resolution is now correctly set.

Calcolo della velocità del nastro

Il device, per calcolare la velocità con cui si muove il nastro, conta il numero di impulsi ricevuti dall'encoder su un breve intervallo di tempo (tempo di campionamento), dividendo tale valore per la durata dell'intervallo si ottiene la velocità media all'interno del periodo.
Il parametro tbf consente di scegliere la durata del tempo di campionamento, è stata data questa possbilità all'utente perché, nel caso in cui il nastro si muova a velocità molto bassa si dovrà impostare un tempo lungo. In caso contrario potrebbe accadere che nel tempo di campionamento non si ricevano sufficienti campioni per poter determinare la velocità.
Si ricorda che, ovviamente, un tempo di campionamento lungo comporta un aggiornamento della velocità piuttosto lento.

È stato introdotto inoltre un filtro software che può essere utilizzato nel calcolo della velocità del nastro. Questo filtro è di tipo passabasso e la sua costante di tempo può essere impostata con il parametro tfilter, inoltre si può scegliere se attivare questo filtro quando la velocità del nastro subisce una variazione in un tempo di campionamento superiore ad un certo parametro. Questo parametro è impostato tramite dvelf. Questo filtro ritorna utile per evitare un valore misurato della velocità che oscilli troppo, si può affermare che la sua funzione è di “mediare” la velocità calcolata.

L'unità di misura della velocità istantanea del nastro viene scelta tramite i parametri unitvel e decpt. È possibile scegliere l'unità di tempo della velocità con il parametro unitvel: se questo è pari a 0 allora la velocità è misurata in Um/min, se è pari a 1 allora è misurata in Um/s. Il parametro decpt invece stabilisce se misurare i valori di velocità in multipli dell'unità di misura fondamentale Um. Ad esempio, se l'unità di misura fondamentale Um=mm, ed unitvel=1 si ottiene la visualizzazione della velocità nella variabile vel in:
mm/s (con decpt = 0),
cm/s (con decpt = 1),
dm/s (con decpt = 2),
m/s (con decpt = 3).
In seguito, se necessario, bisognerà configurare correttamente la visualizzazione sul terminale operatore per aggiustare la corretta posizione del punto decimale.

Calibrazione del sensore di presenza pezzo

I sensori di presenza pezzo hanno una posizione fissa nella configurazione della macchina: il primo, posto all'inizio del nastro trasportatore, ha il compito di identificare inizio e fine del pezzo, eventualmente possono essere utilizzati altri due sensori posti ad una certa distanza dall'inizio del nastro per effettuare un “rifasamento” della posizione del pezzo.
I parametri disti02 e disti03 consentono di impostare la distanza dei sensori 2 e 3 dal primo.

Il primo sensore identificherà anche l'inizio del nastro, ogni volta che questo sarà attivato i parametri posit ed encoder viene azzerato.
Nel caso in cui il sensore di presenza pezzo sia un finecorsa meccanico potrebbe essere necessario introdurre un anticipo o un ritardo della fine del pezzo rispetto il fronte di discesa del segnale. Questo può essere impostato con il parametro offseti01.
Il parametro beltlength consente di impostare la lunghezza del nastro, il device quando identificherà la presenza di materiale manterrà attiva l'uscita del soffiatore.

Setup teste di lavorazione

La modalità per configurare le teste di lavorazione si discosta dalla semplice introduzione di un valore in un parametro. Infatti è necessario utilizzare degli appositi comandi (WRITESET, WRITEPRG e WRITEVAR), questo è dovuto all'implementazione interna del device.
I primi parametri da introdurre saranno quelli tramite il comando WRITESET:
dist determina la distanza tra il primo sensore presenza pezzo e il centro della testa di lavoro in questione,
mode consente di determinare la funzione che dovrà svolgere la testa,
i parametri riseadv e downlag configurano gli anticipi/ritardi di salita/discesa teste con la modalità descritta nel manuale del device.

La procedura per introdurre i parametri è la seguente:

[...]
Teste:headin = 2                       ;configurazione della testa 2
Teste:dist = 100                       ;distanza impostata a 100 Um dal sensore presenza pezzo
Teste:mode = 1                         ;testa impostata come levigatrice
Teste:riseadv1 = 5                     ;impostazione dell'anticipo salita testa legato alla velocità correvel1
Teste:riseadv2 = 7                     ;impostazione dell'anticipo salita testa legato alla velocità correvel2
Teste:riseadv3 = 10                    ;impostazione dell'anticipo salita testa legato alla velocità correvel3
Teste:downlag1 = 6                     ;impostazione del ritardo discesa testa legato alla velocità correvel1
Teste:downlag2 = 8                     ;impostazione del ritardo discesa testa legato alla velocità correvel2
Teste:downlag3 = 12                    ;impostazione del ritardo discesa testa legato alla velocità correvel3
Teste:headout = 0                      ;imposto headout a 0
WRITESET Teste                         ;invio comando di scrittura
WAIT Teste:headout EQ Teste:headin     ;attesa comando eseguito
[...]

Questa procedura (scelta della testa da impostare con il parametro headin, modifica dei parametri, invio del comando) va effettuata anche quando si utilizzano i comandi di lettura e scrittura WRITEPRG, READPRG, WRITEVAR, READVAR.

Tramite WRITEPRG è possibile inserire le configurazioni relative alla modalità di lavorazione della testa.

WRITEVAR invece consente di leggere dei parametri relativi alla lavorazione in corso.
Lo stesso meccanismo di lettura dei parametri funziona con il comando READPIECE che consente di conoscere delle informazioni su uno specifico pezzo in lavorazione.

Quando si desidera leggere continuamente i valori dei parametri relativi a tutte le teste, si può semplicemente utilizzare un ciclo for per leggere e memorizzare in un array i parametri a cui si è interessati:

[...]
FOR (gbCount=1, gbCount LE 8, 1)      ;inizializzazione ciclo for
  Teste:headin = gbCount              ;configuro tutte le teste da 1 a 8
  Teste:dist = gbCount * 10           ;teste equispaziate di 10 Um
  Teste:mode = 1                      ;tutte teste levigatrici
  WRITESET Teste                      ;invio comando di scrittura
  WAIT Teste:headout EQ Teste:headin  ;attesa comando eseguito
NEXT
[...]
[...]
FOR (gbCount=1, gbCount LE 8, 1)      ;inizializzazione ciclo for
  Teste:headin = gbCount              ;configuro tutte le teste da 1 a 8
  READVARSET Teste                    ;invio comando di lettura
  WAIT Teste:headout EQ Teste:headin  ;attesa comando eseguito
  Teste:actriseadv = garray[1]        ;memorizzo la correzione di anticipo nella prima posizione di un array
  Teste:actdownlag = garray[2]        ;memorizzo la correzione di ritardo nella seconda posizione di un array
  Teste:actpiece = garray[3]          ;memorizzo il numero del pezzo in lavorazione nella terza posizione di un array
NEXT
[...]